﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SingletonDemo
{
    /// <summary>
    /// 单例模式（饿汉模式）
    /// 
    /// 111
    /// 优点：在系统启动时，只需要实例化一次，后续调用时，直接返回实例化的对象，减少系统开销。
    /// 1111
    /// zlf ---11
    /// zlf-2
    /// m2
    /// zlf1
    /// zlf2222
    /// </summary>
    public class Singleton67
    {
        private static Singleton67 instance = new Singleton67();

        private Singleton67()
        {

        }

        public static Singleton67 GetInstance
        {
            get
            {
                return instance;
            }
        }

        public void test1()
        {
            Console.WriteLine("Singleton67 operation");
        }
    }
}
